<script setup lang="ts">
import  { inject, type Ref, ref } from 'vue';

const totalNum = inject<Ref<number>>('totalNum',ref(0))

const uploadTotalNum = inject('uploadTotalNum',(num:number)=>{ })
</script>

<template>
  <div class="sonson">
    <h3>后代{{ totalNum }}</h3>
    <button @click="totalNum++">后代修改</button>
    <button @click="uploadTotalNum(10)">调用回调函数+10</button>
  </div>
</template>

<style scoped>
  
</style>